﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class LogInPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
        {
            Response.Redirect("/admin/Home.aspx");
        }
    }
    protected void Login_OnClick(object sender, EventArgs e)
    {
        if (Membership.ValidateUser(UsernameTextbox.Text, PasswordTextbox.Text)){
            FormsAuthentication.SetAuthCookie(UsernameTextbox.Text, true);
            Response.Redirect("/admin/Home.aspx");
        }
        else
            Msg.Text = "Login failed. Please check your user name and password and try again.";
    }

    

       

}